package br.ufrj.neg.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.velocity.tools.view.VelocityViewServlet;

import br.ufrj.neg.constants.General;
import br.ufrj.neg.usuario.bean.UsuarioBean;
import br.ufrj.neg.usuario.model.UsuarioModel;

public class Redirecionador extends VelocityViewServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		HttpSession session = (HttpSession) request.getSession();
		
		if( request.isUserInRole("6")){
			response.sendRedirect(General.APP_PATH + "interno/negociacao/listar");
		}
		else{
			session.removeAttribute("usuarioBean");
			session.invalidate();
			response.sendRedirect(General.APP_PATH +  General.TELA_ERRO_LOGIN);
		}
	
	}
}
